﻿using Application.Dto;
using Application.IAppSrevices;
using AutoMapper;
using Domain.Entitys;
using Domain.Repositorys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Application.AppSrevices
{
	public class ERService : IERService
	{
		private readonly IMapper mapper;
		private readonly IERRepositoy eRRepositoy;

		public ERService(IMapper mapper, IERRepositoy eRRepositoy)
		{
			this.mapper = mapper;
			this.eRRepositoy = eRRepositoy;
		}
		/// <summary>
		/// 添加
		/// </summary>
		/// <param name="eRAddDto"></param>
		/// <returns></returns>
		public async Task<int> ERAddAsync(ERAddDto eRAddDto)
		{
			ER er = mapper.Map<ER>(eRAddDto);
			return await eRRepositoy.ERAddAsync(er);
		}

		public int ERSelectCount()
		{
			return eRRepositoy.ERSelectCount();
		}

		public Task<List<ER>> ERSelectSie(int flid, int ncid, string name, DateTime time, DateTime timimo, string CheckStatus, int pageIndex, int pageSize)
		{
			return eRRepositoy.ERSelectSie(flid, ncid, name, time, timimo, CheckStatus, pageIndex, pageSize);
		}

		public async Task<int> ERUpdateAsync(ERupdateDto eRupdateDto)
		{
			ER er = mapper.Map<ER>(eRupdateDto);
			return await eRRepositoy.EMRUpdateAsync(er);
		}

		public async Task<int> ERUpdateSX2id(ERUpdateSX2Dto eRUpdateSX2Dto)
		{
			ER er = mapper.Map<ER>(eRUpdateSX2Dto);
			return await eRRepositoy.ERUpdateSX2ID(er);
		}

		public async Task<int> ERUpdateSXid(ERUpdateSXDto eRUpdateSXDto)
		{
			ER er = mapper.Map<ER>(eRUpdateSXDto);
			return await eRRepositoy.ERUpdateSXID(er);
		}

		public async Task<int> ERUpdateZTid(ERUpdateZTDto eRUpdateZTDto)
		{
			ER er = mapper.Map<ER>(eRUpdateZTDto);
			return await eRRepositoy.ERUpdateZTid(er);
		}

		public Task<ER> SelectId(int id)
		{
			return eRRepositoy.SelectId(id);
		}

		public Task<List<ER>> SelectLYCX(string PassCheckComment, string PassPassComment, int pageIndex, int pageSize)
		{
			return eRRepositoy.SelectLYCX(PassCheckComment, PassPassComment, pageIndex, pageSize);
		}

		public Task<List<ER>> SelectLYSQ(string PassCheckComment, int pageIndex, int pageSize)
		{
			return eRRepositoy.SelectLYSQ(PassCheckComment, pageIndex, pageSize);
		}

		public Task<List<ER>> SelectMSZTId(int id, int pageIndex, int pageSize)
		{
			return eRRepositoy.SelectMSZTId(id, pageIndex, pageSize);
		}

		public Task<List<ER>> SelectZTId(int id, int pageIndex, int pageSize)
		{
			return eRRepositoy.SelectZTId(id, pageIndex, pageSize);
		}
        public int ERSelectString2Count(string PassCheckComment, string PassPassComment)
        {
            return eRRepositoy.ERSelectString2Count(PassCheckComment, PassPassComment);
        }

        public int ERSelectStringCount(string PassCheckComment)
        {
            return eRRepositoy.ERSelectStringCount(PassCheckComment );
        }
        public int ERSelectIDCount(int id)
        {
            return eRRepositoy.ERSelectIDCount(id);
        }

        public int ERSelectCount(int flid, int ncid, string name, DateTime time, DateTime timimo, string CheckStatus)
        {
			return eRRepositoy.ERSelectCount(flid,ncid,name,time,timimo,CheckStatus);
        }

        public Task<int> SelectMSZTIdCount(int id)
        {
			return eRRepositoy.SelectMSZTIdCount(id);
        }
    }
}
